package com.hctforgreen.greenservice;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

public class AfterSalesLearningResultActivity extends ParentActivity implements View.OnClickListener {

    /**
     * 外部Activity启动本Activity
     *
     * @param activity
     */
    public static void launch(Activity activity) {
        Intent intent = new Intent(activity, AfterSalesLearningResultActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new_staff_learning_result);

        initTitleButtonBar();
        initSkinLayout();
        initView();
    }

    private void initTitleButtonBar() {
        final TextView titleTv = (TextView) findViewById(R.id.tv_title);
        titleTv.setText(getString(R.string.after_sales_learning_result));

        final ImageButton backBtn = (ImageButton) findViewById(R.id.btn_back);
        backBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initView() {
        findViewById(R.id.lyt_home_train).setOnClickListener(this);//家用培训
        findViewById(R.id.lyt_commercial_train).setOnClickListener(this);//商用培训
        findViewById(R.id.lyt_life_electric).setOnClickListener(this);//生活电器
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.lyt_home_train:
                HomeRepairInstallActivity.launch(this);
                break;
            case R.id.lyt_commercial_train:
                Toast.makeText(this, "商用空调功能尚未开通，敬请期待哦", Toast.LENGTH_SHORT).show();
                break;
            case R.id.lyt_life_electric:
                Toast.makeText(this, "生活电器功能尚未开通，敬请期待哦", Toast.LENGTH_SHORT).show();
                break;
            default:
                break;
        }
    }
}
